package commonlib
{
	public final class Utility
	{
		public function Utility()
		{
		}
		
		public static function sortAsc(list:Object, key:String):Object
		{
			list.sort(function(a:Object, b:Object):int
			{						
				if (a[key] > b[key])
				{
					return 1;
				}
				else if(a[key] < b[key])
				{
					return -1;
				}				
				else
				{
					return 0;
				}
			});
			return list;
		}
		
		public static function sortDesc(list:Object, key:String):Object
		{
			list.sort(function(a:Object, b:Object):int
			{						
				if (a[key] < b[key])
				{
					return 1;
				}
				else if(a[key] > b[key])
				{
					return -1;
				}				
				else
				{
					return 0;
				}
			});
			return list;
		}
	}
}